package org.dromara.iot.handler;


import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.mqtt.handler.MqttMessageHandler;
import org.dromara.iot.domain.vo.IotElevatorVo;
import org.dromara.iot.service.IIotElevatorEventService;
import org.dromara.iot.service.IIotElevatorService;
import org.dromara.system.service.ISysOssService;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.stereotype.Service;

@Slf4j
@RequiredArgsConstructor
@Service
public class personCountHandler implements MqttMessageHandler {
    private final IIotElevatorService elevatorService;
    private final ISysOssService ossService;
    private final IIotElevatorEventService elevatorEventService;

    @Override
    public void handle(String code, MqttMessage message) {
        IotElevatorVo iotElevator = elevatorService.selectByRegisteredCode(code);
        if (iotElevator == null) {
            log.error("接收到状态消息，但电梯不存在:{}", code);
            return;
        }
        log.info("接收到设备[{}]的[{}]消息", code, "personCount");
    }
}
